package midimaker.ui;

import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class InstrumentItem extends JPanel {

	private static final long serialVersionUID = 1L;
	
	private final JLabel label;
	private final JCheckBox[] bits;
	
	public InstrumentItem (String label) {
		this.label = new JLabel(label);
		this.bits = new JCheckBox[16];
		
		this.label.setBounds(20, 0, 200, 30);
		this.setLayout(null);
		JPanel rightPanel = new JPanel();
		
		for (int i = 0; i < bits.length; i++) {
			bits[i] = new JCheckBox();
			rightPanel.add(bits[i]);
		}
		rightPanel.setSize(650, 30);
		this.add(this.label);
		this.add(rightPanel);		
	}
	
	public boolean[] getSequences() {
		boolean[] bits = new boolean[16];
		for(int i = 0; i < this.bits.length; i++) {
			bits[i] = this.bits[i].isSelected();
		}
		return bits;
	}
	
}
